package com.songshuai.webapi.baseapi.enumerations.sales.error;

import lombok.extern.slf4j.Slf4j;
@Slf4j
public enum SalesInfoError {



     ERROR_SALES_INFO(1,"盘古信息：身份信息不正确"),
     ERROR_SALES_BIND_USER(2,"绑定失败"),
     ERROR_SALES_REGET_WXCODE(-2,"重新获取code"),
     ERROR_SALES_RELOGIN(-1,"请登录");



        private int code;
        private String msg;

    SalesInfoError(int code, String msg){
            this.code = code;
            this.msg = msg;
        }

        public static int getCode(String define){
            try {
                return com.songshuai.webapi.baseapi.enumerations.sales.error.SalesInfoError.valueOf(define).code;
            } catch (IllegalArgumentException e) {
                return 0;
            }
        }

        public static String getMsg(String define){
            try {
                return com.songshuai.webapi.baseapi.enumerations.sales.error.SalesInfoError.valueOf(define).msg;
            } catch (IllegalArgumentException e) {
                return "";
            }
        }

        public static String getMsg(Integer code){
            if(code==null||code<=0)
                return "";
            for(com.songshuai.webapi.baseapi.enumerations.sales.error.SalesInfoError err : com.songshuai.webapi.baseapi.enumerations.sales.error.SalesInfoError.values()){
                if(err.code==code){
                    return err.msg;
                }
            }
            return "";
        }

        public int getCode(){
            return code;
        }

        public String getMsg(){
            return msg;
        }
    }

